package com.educationagent.util;

import lombok.Data;

@Data
public class Result {
    private String code;
    private String message;
    private Object data;


    public static Result success() {
        Result result = new Result();
        result.code = "200";
        result.message="成功";
        return result;
    }

    public static Result success(String message) {
        Result result = new Result();
        result.code = "200";
        result.message=message;
        return result;
    }

    public static Result success(Object data) {
        Result result = success();
        result.data = data;
        return result;
    }

    public static Result success(Object data, String message) {
        Result result = success(message);
        result.data = data;
        return result;
    }


    public static Result fail() {
        Result result = new Result();
        result.code = "500";
        result.message="失败";
        return result;
    }

    public static Result fail(String message) {
        Result result = new Result();
        result.code = "500";
        result.message=message;
        return result;
    }

    public static Result fail(Object data) {
        Result result = fail();
        result.data = data;
        return result;
    }

    public static Result fail(Object data, String message) {
        Result result = fail(message);
        result.data = data;
        return result;
    }




}
